<template>
  <div>
    <van-search v-model="value" placeholder="韩版新款连衣裙" style="width: 300px;height: 40px; float: left;" /><van-icon name="chat-o" size="3rem" style="float: right; line-height: 40px;" />
    <div style="height: 45px; clear: both;"></div>
    <!-- 宫格区块 -->
    <van-grid :column-num="5">
      <van-grid-item v-for="item in images" :key="item" src :icon="item.img" :text="item.name" />
    </van-grid>
    <!-- 楼层数据 -->
    <div v-for="item in floorData" class="items">
      <img :src="item.floor_title.image_src" alt="" style="width: 100%;">
      <div v-for="items in item.product_list">
        <dl style="float: left;">
          <dt>
            <img :src="items.image_src" alt="" style="width: 100px; height: 100px; margin: 5px;">
          </dt>
          <dd>
            <p>{{ items.name }}</p>
          </dd>
        </dl>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
// 引入接口
import { floorApi } from '@/api/api'
// 自定义渲染数据
let floorData = ref([])
floorApi().then(res => {
  console.log('楼层数据', res)
  floorData.value = res.data.message
})
// 宫格数据渲染
let images = ref([
  { img: '@/src/images/logon_03.jpg', name: '女装' },
  { img: '../../images/logon_05.jpg', name: '女鞋' },
  { img: '../../images/logon_07.jpg', name: '上衣' },
  { img: '../../images/logon_09.jpg', name: '美妆' },
  { img: '../../images/logon_11.jpg', name: '护肤' },
  { img: '../../images/logon_18.jpg', name: '裤子' },
  { img: '../../images/logon_19.jpg', name: '母音' },
  { img: '../../images/logon_20.jpg', name: '裙子' },
  { img: '../../images/logon_21.jpg', name: '男装' },
  { img: '../../images/logon_22.jpg', name: '男鞋' },
])
</script>

<style lang="scss">
* {
  margin: 0;
  padding: 0;
  list-style: none;

  .items {
    columns: 2;

    div {
      width: 100px;
      height: 100px;
      margin-left: 40px;
      margin-top: 10px;
    }
  }
}
</style>